//
//  CircleView.m
//  CircleView
//
//  Created by J on 16/2/24.
//  Copyright © 2016年 J. All rights reserved.
//

#import "CircleView.h"
@interface  CircleView()
@property(nonatomic,strong)CAShapeLayer* shapeLayer;
@end
@implementation CircleView

- (instancetype)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {
        
        _shapeLayer = [CAShapeLayer layer];
        _shapeLayer.frame = self.bounds;
        
        UIBezierPath* path = [UIBezierPath bezierPathWithOvalInRect:self.bounds];
        
        _shapeLayer.path = path.CGPath;
        _shapeLayer.fillColor = [UIColor clearColor].CGColor;
        _shapeLayer.lineWidth = 1.0;
        _shapeLayer.strokeColor = [UIColor orangeColor].CGColor;
        _shapeLayer.strokeEnd = 0;
        [self.layer addSublayer:_shapeLayer];
        
        
    }
    return self;
}

@synthesize startValue = _startValue;

- (void)setStartValue:(CGFloat)startValue{
    _startValue = startValue;
    _shapeLayer.strokeStart = startValue;
    
}

- (CGFloat)startValue{
    
    return _startValue;
}


@synthesize lineWidth = _lineWidth;

- (void)setLineWidth:(CGFloat)lineWidth{
    _lineWidth = lineWidth;
    _shapeLayer.lineWidth = lineWidth;
    
}

- (CGFloat)lineWidth{
    return _lineWidth;

}


@synthesize lineColor = _lineColor;


- (void)setLineColor:(UIColor *)lineColor{
    _lineColor = lineColor;
    _shapeLayer.strokeColor = lineColor.CGColor;
    
    
}
- (UIColor *)lineColor{
    return _lineColor;
}

- (void)setValue:(CGFloat)value{
    _value = value;
    _shapeLayer.strokeEnd = value;
}


@end
